package com.indusfo.spc.controller;

import com.indusfo.spc.aspect.SystemControllerLog;
import com.indusfo.spc.pojo.WarehousePlace;
import com.indusfo.spc.service.WarehousePlaceService;
import com.indusfo.spc.vo.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


/**
 * 库位控制层
 */
@Controller
@RequestMapping("/warehousePlace")
public class WarehousePlaceController {

    @Autowired
    private WarehousePlaceService warehousePlaceService;

    /**
     * 查询
     * @return com.indusfo.spc.vo.JSONObject
     */
    @RequestMapping(value="/queryWarehousePlace")
    @SystemControllerLog(description="查询")
    @ResponseBody
    public JSONObject queryWarehousePlace(WarehousePlace warehousePlace) {
        JSONObject json = warehousePlaceService.selectWarehousePlace(warehousePlace);
        return json;
    }

    /**
     * 新增
     * @return com.indusfo.spc.vo.JSONObject
     */
    @RequestMapping(value="/insertWarehousePlace")
    @SystemControllerLog(description="新增")
    @ResponseBody
    public JSONObject insertWarehousePlace(WarehousePlace warehousePlace) {
        JSONObject json = warehousePlaceService.insertWarehousePlace(warehousePlace);
        return json;
    }

    /**
     * 修改
     * @return
     */
    @RequestMapping(value = "/updateWarehousePlace")
    @SystemControllerLog(description="修改")
    @ResponseBody
    public JSONObject updateWarehousePlace(WarehousePlace warehousePlace){
        JSONObject json=warehousePlaceService.updateWarehousePlace(warehousePlace);
        return json;
    }

    /**
     * 启用/停用/删除
     * @return com.indusfo.spc.vo.JSONObject
     */
    @RequestMapping(value="/definesWarehousePlace")
    @SystemControllerLog(description="启用/停用/删除")
    @ResponseBody
    public JSONObject definesWarehousePlace(Long[] warehousePlaceIds, Integer dataState) {
        dataState = 2;
        JSONObject json = warehousePlaceService.definesWarehousePlace(warehousePlaceIds, dataState);
        return json;
    }


}
